package com.kaibes.platform.file.client.db;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kaibes.orm.curd.OrderType;
import com.kaibes.web.api.ResponseServiceImpl;

@Service
public class FileServerService extends ResponseServiceImpl<FileServer> {
	
	
	public FileServer getByLtPriorityAndNotHostList(short priority, List<String> hostList) {
		return get(query().lt("priority", priority).notInList("host", hostList).build(), "priority", OrderType.DESC);
	}
	
	public FileServer getByLtPriorityAndNotIdList(short priority, List<Integer> idList) {
		return get(query().lt("priority", priority).notInList("id", idList).build(), "priority", OrderType.DESC);
	}
	
	public List<FileServer> listByPriorityAndNotIdList(short priority, List<Integer> idList) {
		return list(query().eq("priority", priority).notInList("id", idList).build());
	}
	
	public long countByGtPriority(short priority) {
		return count(query().gt("priority", priority).build());
	}
	
}
